/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 2013-2014 jfinal app. jfapp Group.
 */

define(['adminapp'], function ($app) {
    $app.navactive('booking_rule');

    var action_tpl = Handlebars.compile($("#action_template").html());

    $app.listtable({
        'sAjaxSource' : g.ctx + "admin/booking/rule/list",
        'aoColumns'   : [
            $app.checkall,
            $app.autono,
            {'mDataProp': 'name' },
            {'mDataProp': 'bname' },
            {'mDataProp': 'cname' },
            {'mDataProp': 'start_time' },
            {'mDataProp': 'end_time' },
            {'mDataProp': 'num' },
            {'mDataProp': 'currency' },
            {'mDataProp': 'dialy_degree' }
        ],
        'aoColumnDefs': [
            {
                'aTargets' : [8],
                'mData'    : null,
                'mRender'  : function (data, type, full) {
                    var oper = full['oper'];
                    if (oper == -1) {
                        return "-" + full["currency"];
                    } else if (oper == 0) {
                        return "无"
                    } else if (oper == 1) {
                        return "+" + full["currency"];
                    }
                    return '';
                }
            },
            {
                'aTargets' : [10],
                'mData'    : null,
                'mRender'  : function (data, type, full) {
                    return action_tpl(full);
                }
            }
        ]
    }, 'data-list');

});

